using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace GameStateManagement
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Shield : PowerUp
    {

        public Shield(Game game, float magnitudeRatio, float speed)
            : base(game, magnitudeRatio, speed)
        {
            sMeshName = "ShieldPowerUp";
            type = "Shield";
            bPhysicsDriven = false;
            
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            abilityCounter.Update(gameTime);
            base.Update(gameTime);
        }

        public override void UseAbility(Player passedPlayer)
        {
            if (!passedPlayer.m_Ship.isInvincible)
            {
                passedPlayer.m_Ship.activateShield();
                passedPlayer.m_Ship.isInvincible = true; //activates invincibility, need to add a new ship model to change it to and make the deactivate call work
                abilityCounter.AddTimer("deactivate", 5f, new Utils.TimerDelegate(passedPlayer.m_Ship.deactivateShield), false);
            }
        }
    }
}
